Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/issue 641 filtering env props #2

Draft
wants to merge 10 commits into
base: feature/issue-641-tooling-tests
Choose a base branch
from

Conversation

crizzis
Copy link
Owner

@crizzis crizzis commented Jun 23, 2022

No description provided.

Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
@crizzis crizzis force-pushed the feature/issue-641-filtering-env-props branch from 5547f57 to 7429227 Compare June 23, 2022 17:06
@@ -62,7 +68,3 @@ def configureDependencies = { deps ->
}
}
this.with project(':archunit-junit').configureJUnitArchive(configureDependencies)

singlePackageExport {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what to do about this one (should I just move everything from internal/filtering to internal? If the other PRs are merged there will be a lot more filtering stuff)

String escaped = SPECIAL_REGEX_CHARS.matcher(pattern).replaceAll(ESCAPED_INPUT);
escaped = MULTIPLE_ESCAPED_ASTERISK.matcher(escaped).replaceAll(SINGLE_ESCAPED_ASTERISK_STRING);
escaped = SINGLE_ESCAPED_ASTERISK.matcher(escaped).replaceAll(MATCH_ALL_CHARACTERS);
return Pattern.compile("(?:^|\\.)" + escaped + "$", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
Copy link
Owner Author

@crizzis crizzis Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure about case sensitivity, please make a decision

(in case any explanation is needed for the (?:^|\\.) bit, ^ is supposed to match FQ names, while \\. is supposed to match simple names - i.e. match must start at a dot, presumably where the package name ends)

private static class SelectorMatcher {

private static final String SINGLE_ESCAPED_ASTERISK_STRING = "\\\\*";
private static final Pattern MULTIPLE_ESCAPED_ASTERISK = Pattern.compile("(\\\\\\*)+");
Copy link
Owner Author

@crizzis crizzis Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://xkcd.com/1638/ 😞

I tried using Pattern.LITERAL to make those patterns a bit more readable, but I couldn't make it right


import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;

public class AnotherClass {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These must exist in order for FieldSource.from and FieldSelector.selectField not to throw an exception

.filters()
.build();
private org.junit.platform.engine.TestEngine[] manuallyLoadCorrectTestEngines(TestFile testFile) {
List<String> engineIds = engineResolver.resolveJUnitEngines(testFile);
Copy link
Owner Author

@crizzis crizzis Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same configuration problem as with the other cases - Vintage and ArchUnit cannot be used simultaneously

void shouldOnlyExecuteSelectedTests(TestEngine engine, Class<?> fixture) throws Exception {
assumeTrue(engine instanceof JUnitJupiterEngine);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only one supported for now, of course

Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
@crizzis crizzis force-pushed the feature/issue-641-filtering-env-props branch from c3c4f39 to d064bc2 Compare June 27, 2022 08:16
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Signed-off-by: Krzysztof Sierszeń <krzysztof.sierszen@digitalnewagency.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant